package com.pimee.web.job;

import java.util.Map;

import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.ModelMap;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;

import com.github.pagehelper.PageInfo;
import com.pimee.job.service.ISysJobLogService;
import com.pimee.model.SysJobLog;
import com.pimee.web.AbstractController;

import io.swagger.annotations.ApiOperation;

/**
 * 调度日志操作处理
 * 
 * @author Bruce Shaw 2020年2月5日 下午9:56:57
 *
 */
@Controller
@RequestMapping("/monitor/jobLog")
public class SysJobLogController extends AbstractController {
	private String prefix = "admin/monitor/job";

	@Autowired
	private ISysJobLogService sysJobLogService;

	@RequiresPermissions("monitor:job:view")
	@GetMapping()
	public String jobLog() {
		return prefix + "/jobLog";
	}

	@ApiOperation("获取定时任务分页列表")
	@RequiresPermissions("monitor:job:list")
	@PostMapping("/list")
	@ResponseBody
	public Object list(@RequestParam Map<String, Object> params, ModelMap modelMap) {
		PageInfo<SysJobLog> list = sysJobLogService.pageList(params);
		return setSuccessModelMap(modelMap, list);
	}
}
